<!--
 * @Author: cqg
 * @Date: 2020-12-10 09:47:34
 * @LastEditTime: 2021-04-25 16:21:11
 * @Description: file content
 * @LastEditors: xjt
-->

<template>
  <div class="previewPage">
    <el-dialog custom-class="small-padding-dialog" title="查看" :visible.sync="formVisible" width="1200px" class="basic-from" @close="close">
      <el-tabs v-model="activeName" v-if="formVisible">
        <el-tab-pane label="工程登记信息" name="project">
          <project :form="form.epcProject" />
        </el-tab-pane>
        <el-tab-pane label="立项信息" name="projectInfo" v-if="form.epcProjectSetup.epcProjectSetup">
          <projectInfo :form="form.epcProjectSetup" />
        </el-tab-pane>
        <el-tab-pane label="招标信息" name="tenderInfo" v-if="form.epcProjectTender.epcProjectTender">
          <tenderInfo :form="form.epcProjectTender" />
        </el-tab-pane>
        <el-tab-pane label="合同信息" name="contract" v-if="form.epcProjectContract||form.epcProjectSubContracts">
          <contract :form="{...form.epcProjectContract,epcProjectSubContracts:form.epcProjectSubContracts}" />
        </el-tab-pane>
        <el-tab-pane label="付款信息" name="payment" v-if="form.paymentRecord">
          <payment :form="form.paymentRecord" />
        </el-tab-pane>
        <el-tab-pane label="验收信息" name="accept" v-if="form.epcProjectAccept">
          <accept :form="form.epcProjectAccept" />
        </el-tab-pane>
        <el-tab-pane label="结算/决算信息" name="finalAccounts" v-if="form.epcProjectEnd">
          <finalAccounts :form="form.epcProjectEnd" />
        </el-tab-pane>
        <el-tab-pane label="财产决算/资产移交信息" name="finalTransfer" v-if="form.epcProjectFinal||form.epcProjectTransfer">
          <finalTransfer :form="{...form.epcProjectFinal,...form.epcProjectTransfer}" />
        </el-tab-pane>
      </el-tabs>
      <span slot="footer">
        <el-button @click="$bus.$emit('operationLog', projectId)">操作日志</el-button>
        <el-button @click="formVisible=false">关闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { queryEngineering } from "./api.js";
import { project, projectInfo, tenderInfo, contract, payment, accept, finalAccounts, finalTransfer } from './components'
export default {
  name: "overview",
  inject: ["initList"],
  data () {
    return {
      projectId: '',
      activeName: 'project',
      //验收弹窗开关
      formVisible: false,
      // 表单数据
      form: {
        epcProject: {},
        epcProjectSetup: {},
        epcProjectTender: {},
        paymentRecord: {},
        epcProjectAccept: {},
        epcProjectEnd: {},
      },
    };
  },
  components: {
    project, projectInfo, tenderInfo, contract, payment, accept, finalAccounts, finalTransfer
  },
  methods: {
    close () {
      // 表单数据
      this.form = {
        epcProject: {},
        epcProjectSetup: {},
        epcProjectTender: {},
        paymentRecord: {},
        epcProjectAccept: {},
        epcProjectEnd: {},
      },
        this.formVisible = false;
    },
    //显示弹窗
    async show (data) {
      this.projectId = data.projectId
      this.activeName = 'project'
      const rps = await queryEngineering(data.projectId)
      this.formVisible = true;
      this.form = rps.data.data
    },
  }
};
</script>
<style lang="scss" >
@import "./public/overview.scss";
</style>
